
def fib(n):
    a = 0
    b = 1

    count = 0
    while count < n:
        tmp = a # 给新的a赋值前，先把旧的存下来
        a   = b
        b   = tmp + b
        # print(a,b)
        yield b # 暂停   执行到这return b 然后暂停
        count += 1

print(fib(20))

f = fib(20)

print(next(f))
print(next(f))
print(next(f))
print(next(f))